#pragma once


#include <d3dx9.h>


#include "IResourceObject.h"
#include "IRenderable.h"
#include "SceneNode.h"

class CResourceBitmapFont;

class CResourceBitmapText : public CSceneNode, public IResourceObject, public IRenderable
{
	protected:
		bool	m_textChanged;
		char*	m_text;
		DWORD	m_color;

		IDirect3DTexture9*	m_sourceTexture;
		ID3DXSprite*		m_spriteInterface;

		CResourceBitmapFont*	m_fontType;

	public:
		CResourceBitmapText();
		~CResourceBitmapText();

		bool CreateBitmapText(const char *_text, CResourceBitmapFont *_fontType, DWORD _color = D3DCOLOR_XRGB(255,255,255));

		bool OnInitResource(ICompHandler *_handler);
		bool OnFreeResource(ICompHandler *_handler);

		void Render(IDirect3DDevice9 *_device, D3DXMATRIX *_transformation);

		inline const CResourceBitmapFont* GetFont() const	{ return this->m_fontType; }
		inline const char* GetText() const					{ return this->m_text; }

		void SetText(const char *_text);
		inline void SetFont(CResourceBitmapFont *_font)	{ this->m_fontType = _font; }

		bool IsRenderable() { return true; }
};